package top.eggcode.system.modules.log.control;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.eggcode.common.base.PackBaseController;
import top.eggcode.common.model.ResponseResult;
import top.eggcode.system.modules.log.model.ExceptionLogQuery;
import top.eggcode.system.modules.log.model.ExceptionLogView;
import top.eggcode.system.modules.log.service.ExceptionLogServiceImpl;


/**
 * Title:
 * Description: TODO
 * Date: 2021/5/27 23:57
 *
 * @author JiaQi Ding
 * @version 1.0
 */
@Api(tags = "系统异常日志")
@AllArgsConstructor
@RequestMapping("/api/log/exception")
@RestController
public class ExceptionLogController extends PackBaseController {

    private final ExceptionLogServiceImpl selfService;

    @GetMapping("{id}")
    public ResponseResult<?> get(@PathVariable String id) {
        return super.pack(selfService.get(id).get(), ExceptionLogView.class);
    }

    @ApiOperation("列表分页")
    @GetMapping("list/page")
    public ResponseResult<?> listPage(ExceptionLogQuery query) {
        return super.pack(selfService.page(query), ExceptionLogView.class);
    }

}
